<template>
	<view>
		<van-cell title="昵称"  :value="user.nickName" />
		<van-cell title="头像"  center>
			<view slot="">
				<van-image fit="cover" radius="10px" width="4rem" height="4rem" :src="user.avatarUrl" use-label-slot />
			</view>
		</van-cell>
		<van-cell title="个性签名" center is-link :value="user.signature" @click="toEdit('signature','个性签名',user.signature)" />
		<van-cell title="邮箱" is-link :value="user.email" @click="toEdit('email','邮箱',user.email)"/>
		<van-cell title="性别" is-link :value="user.gender" @click="toEdit('gender','性别',user.gender)"/>
		<van-cell title="手机号码" :value="user.phone"/>
		<van-cell title="真实姓名" is-link :value="user.realName" @click="toEdit('realName','真实姓名',user.realName)"/>
		<van-cell title="星座" is-link :value="user.constellation" @click="toEdit('constellation','星座',user.constellation)"/>
		<van-cell title="生日" is-link :value="user.birthdate" @click="toEdit('birthdate','生日',user.birthdate)"/>
		<van-cell title="开摆编号" :value="user.kbId"/>

	</view>
</template>

<script>
	export default {
		data() {
			return {
				user: {
					birthdate:"",
					realName:"",
					gender:0,
					phone:"",
					constellation:"",
					kbId: 1,
					nickName: "",
					avatarUrl: "",
					signature: "",
					email: ""
				}
			}
		},
		onLoad() {
			this.$request('/user/messageById', {
				}, 'GET').then(res => {
					this.user = res
				})
		},
		methods: {
			toEdit(editKey,editName,currentValue){
				let message = {
					editKey:editKey,
					editName:editName,
					currentValue:currentValue
				}
				let messageString = JSON.stringify(message);
				uni.navigateTo({
					url:"./updateUser?user="+messageString
				})
			}	
		}
	}
</script>

<style>

</style>
